#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int arr[10] = {10,20,40,90};
	int sz = sizeof(arr) / sizeof(arr[0]);
	int n = 0;
	int i = 0;
	int max = 0;
	scanf("%d", &n);
	for (i = 0; arr[i] < n; i++)
	{
		int j = 0;
		int m = n-arr[i];
		for (j = 0; j < sz; j++)
		{
			if (arr[j] == m)
			{
				int min = i < j ? i : j;
				int max = i > j ? i : j;
				printf("%d %d ", i+1, j+1);
				return 0;
			}
		}
		
	}
	return 0;
}